package com.example.usercenter.config;

import org.redisson.Redisson;
import org.redisson.api.RedissonClient;
import org.redisson.config.Config;
import org.springframework.boot.autoconfigure.cache.CacheProperties;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
@ConfigurationProperties(prefix = "spring.data.redis")
public class RedissonConfig {
    private String url;
    private String prot;
    private String password;
    @Bean
    public RedissonClient redissonClient(){
        //创建配置
        Config config = new Config();
        String redisAdress= "redis://127.0.0.1:6379";
        config.useSingleServer().setAddress(redisAdress).setPassword("xue191012.").setDatabase(3);
        //创建实例
        RedissonClient redisson = Redisson.create(config);
        return redisson;
    }
}
